package com.itheima.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 员工
 */
@Data
@ApiModel("Employee")
public class Employee implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 问题：在分页Page<Employee>转换json数据的过程。能不能将Long id转换  String id？
     * 解决：ToStringSerializer 在序列化过程中可以将Long 转换成String
     */
    //@JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * 账号
     */
    @ApiModelProperty("员工账号")
    private String username;
    /**
     * 姓名
     */
    private String name;
    /**
     * 密码
     */
    @ApiModelProperty("员工密码")
    private String password;

    private String phone;

    private String sex;
    /**
     * 身份证
     */
    private String idNumber;
    /**
     * 状态： 1正常，0禁用
     */
    private Integer status;
    /**
     * 目标：给字段做自动填充
     *
     * @TableField(fill = FieldFill.INSERT): 当insert  into employee 什么时机填充
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @TableField(fill = FieldFill.INSERT)
    private Long createUser;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

}
